
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports _2bMatesSite.BO

Namespace _2bMatesSite
	''' <summary>
	''' Summary description for confirm_sp_deletion.
	''' </summary>
	Public Partial Class confirm_sp_deletion
		Inherits BaseWebPage
		Protected pageTypeID As Integer = -1
		Protected htPageConstants As New Hashtable()

		Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
			' Put user code to initialize the page here
			' this.pageTemplate.PageTitle = PageTitles.CONFIRM_SP_DELETION_PAGE;

			Dim user As User = Me.LoggedUser
			If user = Nothing Then
				Common.Utils.RedirectToLoginPage(Page)
			End If

			' init page from XML
			Me.initPageTitles(Constants.CONFIRM_SP_DELETION, "", Form1, Nothing, htPageConstants)
			Me.initAdvertisements(Form1, Nothing)

			If Constants.SHOW_MUSIC <> Constants.SHOW_ON Then
				Throw New Exception(Constants.ERROR_MESSAGE_NO_ACCESS)
			End If

			If user.Status <> Constants.appAdmin Then
				Throw New Exception(Constants.ERROR_MESSAGE_NO_ACCESS)
			End If

			If Request.Params("type") = Nothing OrElse Request.Params("type") = "" Then
				Throw New Exception(Constants.ERROR_MESSAGE_MISSING_PARAMETERS)
			End If

			Try
				pageTypeID = Convert.ToInt32(Request.Params("type"))

				Dim oCurPage As SpecialPage = SpecialPages.GetSpecialPageByID(pageTypeID)

				If oCurPage = Nothing Then
					Throw New Exception(Constants.ERROR_MESSAGE_MISSING_PARAMETERS)
				End If

				lblMessage.Text = (Me.GetPageConstText(htPageConstants, "CONST_MsgQSure_TEXT")).Replace("[PARAM]", oCurPage.Name)
			Catch
				Throw New Exception(Constants.ERROR_MESSAGE_UNEXPECTED_ERROR)
			End Try
		End Sub

		#region Web Form Designer generated code
		Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)
			'
			' CODEGEN: This call is required by the ASP.NET Web Form Designer.
			'
			InitializeComponent()
			MyBase.OnInit(e)
		End Sub

		''' <summary>
		''' Required method for Designer support - do not modify
		''' the contents of this method with the code editor.
		''' </summary>
		Private Sub InitializeComponent()

		End Sub
#End Region

		Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			Try
				Dim oCurPage As SpecialPage = SpecialPages.GetSpecialPageByID(pageTypeID)
				If oCurPage = Nothing Then
					Throw New Exception(Constants.ERROR_MESSAGE_MISSING_PARAMETERS)
				End If

				oCurPage.DoDelete()
				Response.Redirect(Constants.ADD_SPECIAL_PAGE)
			Catch
			End Try

		End Sub

		Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			Response.Redirect(Constants.SPECIAL + "?" + Constants.SPECIAL_PAGE_TYPE_ID_PARAM + "=" + pageTypeID)
		End Sub
	End Class
End Namespace






